<template>
  <!--  @open="handleOpen"
    @close="handleClose" -->
  <el-menu
    :default-active="route.path"
    class="el-menu-vertical-demo"
    :router="true"
    background-color="#191a23"
    active-text-color="#ffffff"
    text-color="#f7f8fa"
    :collapse="store.state.isFoldMenus"
    :collapse-transition="false"
  >
    <!-- 首页 -->
    <el-menu-item index="/index">
      <el-icon><HomeFilled /></el-icon>
      <span>首页</span>
    </el-menu-item>
    <!-- 个人中心 -->
    <el-menu-item index="/center">
      <el-icon><UserFilled /></el-icon>
      <span>个人中心</span>
    </el-menu-item>
    <!-- 用户管理 -->
    <el-sub-menu index="/user-manage">
      <template #title>
        <el-icon><Avatar /></el-icon>
        <span>用户管理</span>
      </template>
      <el-menu-item index="/user-manage/userList">用户列表</el-menu-item>
      <el-menu-item index="/user-manage/userAdd">添加用户</el-menu-item>
    </el-sub-menu>
    <!-- 新闻管理 -->
    <el-sub-menu index="/new-manage">
      <template #title>
        <el-icon><MessageBox /></el-icon>
        <span>新闻管理</span>
      </template>
      <el-menu-item index="/new-manage/newList">新闻列表</el-menu-item>
      <el-menu-item index="/new-manage/newAdd">添加新闻</el-menu-item>
    </el-sub-menu>
    <!-- 产品管理 -->
    <el-sub-menu index="/product-manage">
      <template #title>
        <el-icon><Reading /></el-icon>
        <span>产品管理</span>
      </template>
      <el-menu-item index="/product-manage/productList">产品列表</el-menu-item>
      <el-menu-item index="/product-manage/productAdd">添加产品</el-menu-item>
    </el-sub-menu>
  </el-menu>
</template>

<script setup>
import {
  HomeFilled,
  UserFilled,
  Avatar,
  MessageBox,
  Reading,
} from "@element-plus/icons-vue";
import { useStore } from "vuex";
import { useRoute } from "vue-router";
import { ref } from "vue";
const store = useStore();
const route = useRoute();
console.log(route.path);
</script>

<style lang="scss" scoped>
.el-menu {
  height: 100vh;
}

.el-menu-item {
  color: #fff;
}
.el-menu-item.is-active {
  color: #fff;
  background-color: #2d8cf0;
}
</style>
